package org.example.controller;

import org.example.bean.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController {
    @Autowired
    private Person person;
//    @Autowired
//    private Person1 person1;
    @ResponseBody
    @RequestMapping("/hello")
    public String hello(){
        return "Hello World";
    }

    @ResponseBody
    @RequestMapping("/person")
    public Person person(){
        return person;
    }

    @ResponseBody
    @RequestMapping("/thymeleafdemo")
    public String thymeleafdemo(){ // 返回页面
        return "thymeleafdemo"; }
//    @ResponseBody
//    @RequestMapping("/person1")
//    public Person1 person1(){
//        return person1;
//    }
    @ResponseBody
    @RequestMapping("/testjsp")
    public String testjsp(){
        return "jsp/test";//返回 /WEB-INF/jsp/index.jsp 页面(jsp)
    }
}